<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<!DOCTYPE html>
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title><h:outputText value="#{msg.usl_home_title}" /></title>
            <link href="<% out.print(request.getContextPath());%>/resources/css/position.css" rel="stylesheet" type="text/css" />

        </head>
        <body>

            <jsp:include page="/pages/fragments/header.jsp" />


            <jsp:include page="/pages/fragments/uslMenu.jsp" />


            <section>
                <h:form >
                    <rich:panel >                        
                        <rich:extendedDataTable value="#{wholePatientListBean.lista}" var="entry" styleClass="wide" rows="20" id="table" >
                            <f:facet name="header">
                                <h:outputText value="#{msg.patients_list}"/>
                            </f:facet>

                            <rich:column sortBy="#{entry[0]}" label="#{msg.patient_name}" width="22%">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.patient_name}"/>
                                </f:facet>
                                <h:outputText value="#{entry[0]}" />
                            </rich:column>

                            <rich:column sortBy="#{entry[1]}" label="#{msg.last_name}" width="22%">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.last_name}"/>
                                </f:facet>
                                <h:outputText value="#{entry[1]}"/>
                            </rich:column>

                            <rich:column sortBy="#{entry[2]}" label="#{msg.birthdate}" width="22%">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.birthdate}"/>
                                </f:facet>
                                <h:outputText value="#{entry[2]}">
                                    <f:convertDateTime pattern="#{msg.date_pattern}" />
                                </h:outputText>                                    
                            </rich:column>

                            <rich:column sortBy="#{entry[5]}" width="12%" style="text-align:center">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.sesso}"/>
                                </f:facet>
                                <h:outputText value="M" rendered="#{entry[5]}" style="color: blue;" />     
                                <h:outputText value="F" rendered="#{!entry[5]}" style="color: red;" /> 
                            </rich:column>

                            <rich:column sortBy="#{entry[3]}" label="#{msg.medic}" width="22%">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.medic}"/>
                                </f:facet>
                                <h:outputText value="#{entry[3]} #{entry[4]}"/>                                    
                            </rich:column>


                            


                        </rich:extendedDataTable>
                        <rich:datascroller page="#{wholePatientListBean.page}" for="table" align="left" maxPages="20"  />
                    </rich:panel>

                </h:form>
            </section>






        </body>
    </html>
</f:view>